<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>影院购票</title>
  <link href="../css/bootstrap.css" rel="stylesheet">
  <link href="../../../css/dashboard.css" rel="stylesheet">
  <style>
    body {
      font-family: Arial, sans-serif;
      margin: 0;
      padding: 0;
      background-color: #ececf6;
    }
    header {
      background-color: #ffdf7e; /* 蓝色 */
      color: #171a1d;
      padding: 20px 0;
      text-align: center;
    }
    nav {
      background-color: #7abaff;
      color: #fff;
      padding: 10px;
      text-align: center;
    }
    nav ul {
      list-style-type: none;
      margin: 0;
      padding: 0;
    }
    nav ul li {
      display: inline;
      margin-right: 10px;
    }
    section {
      padding: 20px;
      text-align: center;
    }
    footer {
      background-color: #818182;
      color: #fff;
      text-align: center;
      padding: 10px 0;
      position: fixed;
      bottom: 0;
      width: 100%;
    }
    .movie-poster {
      width: 200px;
      height: auto;
      margin-bottom: 20px;
    }
    .login-button {
      position: absolute;
      top: 70px;
      right: 20px;
      background-color: #cfe2ff;
      color: #23292e;
      padding: 10px 20px;
      border-radius: 5px;
      border: none;
      cursor: pointer;
    }
  </style>
</head>
</head>

<body>
<header>
  <h1>Welcome to 丽江新中数影城</h1>
</header>
<!--顶部菜单 -->
<div th:replace="~{topleft::topnav}"></div>
<div class="container-fluid">
  <div class="row">


    <!--左菜单 -->

    <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
      <h2><a class="btn btn-success btn-sm" href="#" th:href="@{/toAddOrder}">添加订单</a></h2>
      <div class="table-responsive">
        <form action="#" th:action="@{/olist}" method="get">
          <label>电影名称:<input type="text" name="oname" th:value="${oname}"/>&nbsp;</label>
          <button type="submit" class="btn btn-success btn-sm" value="搜索" id="search">搜索</button>
        </form>
        <table class="table table-sm table-hover table-bordered">
          <thead>
          <tr>
            <th>订单编号</th>
            <th>订单详情</th>
            <th>订单位置</th>
            <th>订单价格</th>
            <th>电影名称</th>
            <th>操作</th>

          </tr>
          </thead>
          <tbody>
          <tr th:each="order:${olist}">
            <td th:text="${order.id}"></td>
            <td th:text="${order.detail}"></td>
            <td th:text="${order.position}"></td>
            <td th:text="${order.price}"></td>
            <td th:text="${order.oname}"></td>
            <td class="center">
              <a class="btn btn-success btn-sm" href="#" th:href="@{/selectOrderById/}+${order.id}">查看</a>
              <a class="btn btn-info btn-sm" href="#" th:href="@{/toUpdateOrder/}+${order.id}">修改</a>
              <a class="btn btn-danger btn-sm" href="#" th:href="@{/deleOrder/}+${order.id}">删去</a>
            </td>
          </tr>
          </tbody>
        </table>
        <nav aria-label="Page navigation example">
          <ul class="pagination">
            <li class="page-item">
              <a class="page-link" href="#"
                 th:href="@{/olist(pno=${page.navigateFirstPage},oname=${oname})}" aria-label="Previous">
                <span aria-hidden="true">首页</span>
              </a>
            </li>
            <li class="page-item" th:if="${page.hasNextPage}">
              <a class="page-link" href="#"
                 th:href="@{/olist(pno=${page.nextPage},oname=${oname})}">下页</a>
            </li>
            <li class="page-item" th:if="${page.hasPreviousPage}">
              <a class="page-link" href="#"
                 th:href="@{/olist(pno=${page.prePage},oname=${oname})}">上页</a>
            </li>
            <li class="page-item">
              <a class="page-link" href="#"
                 th:href="@{/olist(pno=${page.navigateLastPage},oname=${oname})}" aria-label="Next">
                <span aria-hidden="true">末页</span>
              </a>
            </li>
          </ul>
        </nav>
      </div>
    </main>
  </div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../js/jquery-3.3.1.min.js"></script>
<script>

  var data = [
    { order_id: 1, detail: '订单1', position: 'A1', price: 10, choose: 136 },
    { order_id: 2, detail: '订单2', position: 'B2', price: 15, choose: 486 },
    { order_id: 3, detail: '订单3', position: 'C3', price: 30, choose: 729 }
  ];



  // 添加新订单的函数
  function addOrderForm() {
    var order = {
      order_id: data.length + 1,
      detail: '新订单',
      position: 'D3',
      price: 40,
      choose: 101


    };

    var order = {
      order_id: data.length + 1,
      detail: '新订单2',
      position: 'H3',
      price: 40,
      choose: 1013


    };
    data.push(order);
    renderOrders();
  }

</script>

</body>

</html>